﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NBusiness.ESharp.Compiler;
using NBusiness.ESharp.Testing.Mocks;
using NBusiness.CodeDom.Compiler;
using NBusiness.CodeDom;
using NBusiness.ESharp.Testing.Properties;
using NBusiness.CodeDom.Services;

namespace NBusiness.ESharp.Testing
{
    [TestClass]
    class CommentsTests
    {
        [TestMethod]
        public void LineCommentsTest1()
        {
            ESharpProvider provider = new ESharpProvider();
            MockBuildErrorService errorService = new MockBuildErrorService();
            MockTypeFinder typeFinderService = new MockTypeFinder();
            provider.SetService(typeof(IBuildErrorService), errorService);

            EntityRoot root = provider.GetParser().ParseFiles(
                new EntityFile ("Comments.Line1.es", Resources.Comments_Line1));

            Assert.AreEqual(0, errorService.Errors.Count);
            Assert.IsNotNull(root.Families["Default"]);
            Assert.AreEqual(1, root.Families["Default"].Entities.Count);
            Assert.AreEqual("Address", root.Families["Default"].Entities[0].Name);
            Assert.AreEqual(3, root.Families["Default"].Entities[0].Fields.Count);
        }
    }
}
